package pl.com.britenet.myredmine.dao.mdb.test;

import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import pl.com.britenet.myredmine.commons.dbunit.BaseDbUnitTestCase;
import pl.com.britenet.myredmine.dao.mdb.domain.Users;
import pl.com.britenet.myredmine.dao.mdb.logic.UsersDAO;


public class UsersDAOTestCase extends BaseDbUnitTestCase {

	private UsersDAO usersDAO = null;
    /**
     * UsersDAOTestCase Constructor
     * 
     * @author <a href="mailto:pawel.sprysak@britenet.com.pl">Paweł Sprysak</a>
     */
	public UsersDAOTestCase() {
		super();
	}
	
	@Override
	@Before
	public void setUp() throws Exception {
		ctx = new ClassPathXmlApplicationContext(new String[] { "classpath:configuration.xml" });
		super.setUp();
		
		usersDAO = (UsersDAO) ctx.getBean("usersDAO");
	}

    /** {@inheritDoc} */
    @Override
    protected String getDateSetFileName() {
        return "src/test/resources/users-data.xml";
    }
    
    /**
     * Test for method 'listUsers'.
     * 
     * @author <a href="mailto:pawel.sprysak@britenet.com.pl">Paweł Sprysak</a>
     */
    @Test
    public void testListUsers() throws Exception {
    	List<Users> usersList = usersDAO.listUsers();

        assertNotNull(usersList);
        System.out.println(usersList.size());
    }
}
